package com.github.llyb120.workflow.entity;

import cn.hutool.core.util.IdUtil;
import lombok.*;

import javax.swing.*;
import java.util.Date;
import java.util.Map;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FlowLog {
    //日志ID
    String id;
    //提交人
    String uid;
    //操作
    String action;
    //提交数据
    Map<String, Object> data;
    //提交日期
    Date created;


    public static FlowLog create(String uid, int action, Map<String, Object> data){
        FlowLog log = FlowLog.builder()
                .id(IdUtil.objectId())
                .created(new Date())
                .action(ActionEnum.getValue(action))
                .uid(uid)
                .data(data)
                .build();
        return log;
    }
}
